import { User } from "@/api/interface";
import { Blog, Subfield } from "@/api/interface/blog";
import { LeaveWord } from "@/api/interface/leaveWord";
import { Tag } from "@/api/interface/tag";
import { Work } from "@/api/interface/work";
import type { SizeType } from "antd/lib/config-provider/SizeContext";
import { Dispatch } from "redux";

/* themeConfigProp */
export interface ThemeConfigProp {
	primary: string;
	isDark: boolean;
	weakOrGray: string;
	breadcrumb: boolean;
	tabs: boolean;
	footer: boolean;
}

/* GlobalState */
export interface GlobalState {
	token: string;
	userInfo: any;
	assemblySize: SizeType;
	language: string;
	themeConfig: ThemeConfigProp;
}

/* MenuState */
export interface MenuState {
	isCollapse: boolean;
	menuList: Menu.MenuOptions[];
}

/* TabsState */
export interface TabsState {
	tabsActive: string;
	tabsList: Menu.MenuOptions[];
}

/* BreadcrumbState */
export interface BreadcrumbState {
	breadcrumbList: {
		[propName: string]: any;
	};
}

/* AuthState */
export interface AuthState {
	authButtons: {
		[propName: string]: any;
	};
	authRouter: string[];
}

export interface UserState {
	userColumn: User.UserInfo[];
}

export interface Action<T> {
	type: string;
	payload: T;
}

export interface LeaveWordState {
	leaveWordList: LeaveWord[];
}

export interface WorkState {
	workList: Work[];
	workDetail: Work;
}

export interface BlogState {
	blogList: Blog[];
	blogDetail: Blog;
	blogTotal: number;
	subfieldList: Subfield[];
}

export interface TagState {
	tagList: Tag[];
	tagDetail: Tag;
	tagTotal: number;
}

export type RootDispatch<T> = Dispatch<Action<T>>;
